package org.tw.twu.cw;

/**
 * Created with IntelliJ IDEA.
 * User: abaluses
 * Date: 24/06/2013
 * Time: 17:22
 * To change this template use File | Settings | File Templates.
 */
public class SimpleDotCom {

    public int[] location;
    public int numberOfTries = 0;
    public int numberOfHits = 0;

    public SimpleDotCom() {

    }

    public void setLocation(int[] location) {
        this.location = location;
    }

    public String verifyHit(String guess) {
        //String status = "Miss";
        int i=0;
        this.numberOfTries++;

        while ( i < this.location.length)
        {
            if (this.location[i]==Integer.parseInt(guess))
            {
                this.numberOfHits++;
                if (this.numberOfHits == this.location.length) return "Dead";
                return "Hit";
            }
            i++;
        }
        return "Miss";  //To change body of created methods use File | Settings | File Templates.
    }
}
